#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    freopen("selectn.in", "r", stdin);
    freopen("selectn.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    int nums[n];
    for (int i = 0; i < n; i++)
        cin >> nums[i];
    sort(nums, nums + n);
    int i = 0, j = n - 1, ans = 0;
    while (i != j)
    {
        int t;
        if ((t = nums[i] + nums[j]) == m)
        {
            ans++;
            i++;
        }
        else if (t > m)
            j--;
        else
            i++;
    }
    cout << ans << endl;
    return 0;
}
